<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<script>
/**
 * 注意：此组件为库存模块：客户查找使用组件
 */
function searchHqCust(){	
		var custName = $("#custName").val();		
			 $('#dataGridCust').datagrid({
		    		url : 'productJSONAction!listCustsDataByPage',    		
		    	    queryParams: {
		    	    	'formBean.custName':custName,    	    	
		    	    },
		    		fit : true,
		    		fitColumns : true,
		    		pagination : true,
		    		pageSize : 15,
		    		pageList : [ 15, 20],
		    		border : false,
		    		selectOnCheck : true,
		    		singleSelect: false,
		    		showFooter:true,
		    		rownumbers:true,
		    		nowrap : false,
		    		columns : [[
		    			{field:'id', width:60,title:'账号',align: 'center',fixed:true},	
    					{field:'name', width:150,title:'客户名称',fixed:true},
    					{field:'pinyin', width:100,title:'客户名称',fixed:true},	
    					{field:'area', width:140,title:'地区',fixed:true},
    					{field:'currentAcctBalance', width:130,title:'欠款',fixed:true},	
    					{field:'address', width:240,title:'地址',fixed:true},
    					{field:'comment', width:170,title:'备注',fixed:true},														
						{field : 'action',title : '选择', width: 80,
							formatter : function(value, row, index) {							
								var str = '';
								str += $.formatString('<a href="#" onclick="selectCust(\'{0}\',\'{1}\');"><img border="0" src="{2}"/></a>',row.id, row.name,'<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/select.png');
								return str;
						}}		
		    		]]	    
		    	});
		        
		        $("#custDialog").dialog("open");		    
}
//选中客户
function selectCust(custId,custName){
	$("#clientID").val(custId);
	$("#custName").textbox("setValue",custName);
	$("#custDialog").dialog("close");
}

function delectCust(){
	$("#clientID").val(0);
	$("#custName").textbox("setValue","");
}

</script>
<s:hidden id="clientID" name="formBean.order.client_id" />
<s:form id="custNameForm" name="custNameForm" action="" theme="simple" method="POST">

	<table  border="0"  class="InnerTableContent">
		<tr>
			<td ><strong>客户：</strong><s:textfield cssClass="easyui-searchbox" id="custName" name="formBean.order.client_name" data-options="prompt:'请输入客户名称',searcher:searchHqCust"  size="15" />
				<a href="#" class="easyui-linkbutton c3" onclick="delectCust()">清除</a>
			</td>										
			
		</tr>
		</table>

</s:form>

<!-- 查找客户 -->
<div id="custDialog" class="easyui-dialog" style="width: 1130px; height: 520px" data-options="title:'查找客户',modal:false,closed:true,resizable:true">	
		    <div id="cc" class="easyui-layout" style="width:1110px;height:470px; position: relative; top:5px;">		    
		    	<table id="dataGridCust" border="0" >
				</table>
		    </div>
</div>
